package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "product_", schema = "boot", catalog = "")
public class Product {//产品表
    private int productId;//产品id
    private String productName;//产品名称
    private String productExplain;//产品说明
    private Category category;//产品类别id
    private List<Productt> productts;
    @Id
    @Column(name = "product_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    
    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    @Basic
    @Column(name = "product_name", nullable = true, length = 200)
    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    @Basic
    @Column(name = "product_explain", nullable = true, length = 200)
    public String getProductExplain() {
        return productExplain;
    }

    public void setProductExplain(String productExplain) {
        this.productExplain = productExplain;
    }

    @ManyToOne
    @JoinColumn(name = "category_id", referencedColumnName = "category_id")
    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    @OneToMany(mappedBy = "product")
    public List<Productt> getProductts() {
        return productts;
    }

    public void setProductts(List<Productt> productts) {
        this.productts = productts;
    }

    @Override
    public String toString() {
        return "Product{" +
                "productId=" + productId +
                ", productName='" + productName + '\'' +
                ", productExplain='" + productExplain + '\'' +
                ", category=" + category +
                ", productts=" + productts +
                '}';
    }
}
